<div id="batchQrcode_rebulid">
    <{toinput from=$filter}>
    <input type="hidden" name="allcount" value="<{$goodscount}>">
    <input type="hidden" name="present_id" value="0">
    <div class="notice"><{t}>正在对<{/t}> <strong class="red"><font size="4"><{$goodscount}></font></strong><{t}>个商品重新生成二维码图片。<{/t}><br/>
      <{t}>1：重新生成新二维码后，原有旧二维码将被删除。<br/>2：该处理过程可能会比较慢，请您耐心等候。<{/t}>
    </div>

    <div class="progessarea" align="center" style='visibility:hidden'></div>
    <div class='lpb'style="border:1px solid #E3E9F1;display:none;">
        <div class="loader lpp gener-bj"></div>
    </div>
    <div>
        <table cellspacing="0" cellpadding="0" border="0" align="center" class="table-action">
            <tr>
                <td>
                    <{button class="btnbuild" type="button" label="开始生成"}>
                </td>
            </tr>
        </table>
    </div>
</div>
<script>
function batchQrcode_rebulidRequest(data){
   if($('batchQrcode_rebulid'))
   return new Request.HTML({url:'index.php?app=b2c&ctl=admin_goods&act=nextQrcode&p[0]',update:$E('.progessarea','batchQrcode_rebulid'),
	   onComplete:function(rs){
		   var step=data['present_id'],allcount=data['allcount'], loader= $E('#batchQrcode_rebulid .loader');
           if(!loader)return;
		   loader.getParent().setStyle('display','');
		   if(!step)return;
		   var num=step/allcount*100;
		   loader.setStyle('width',num+'%');
	   },
   evalResponse:true}).post(data);
}
(function(){

     var batchQrcode_rebulid=$('batchQrcode_rebulid');
     var dialogCloseBtn= batchQrcode_rebulid.getParent('.dialog').getElement('.btn-close');
		 batchQrcode_rebulid.store('closebtn',dialogCloseBtn);

     batchQrcode_rebulid.getElement('.btnbuild').addEvent('click',function(){
      batchQrcode_rebulid.getElement('.progessarea').setStyle('visibility','visible').set('text','生成中...');
      //  dialogCloseBtn.setStyle('visibility','hidden');
      var cancelBtn = this.set('html','<span><span>取消</span></span>');
        cancelBtn.addEvent('click',function(){
            this.getParent('.dialog').retrieve('instance').close();
        });
        batchQrcode_rebulidRequest(batchQrcode_rebulid);
        this.removeEvent('click',arguments.callee);
     });

})();


</script>
